package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Panel;
import com.mall.shopping.dto.PanelContentItemDto;
import com.mall.shopping.dto.PanelDto;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


public class PanelConverter {

    public static Set<PanelDto> panel2Dto(List<Panel> panels, ArrayList<PanelContentItemDto> list) {
        Set set = new HashSet<>();
        for (int i = 0; i < panels.size(); i++) {
            Panel panel = panels.get(i);
            PanelDto panelDto = new PanelDto();
            panelDto.setId(panel.getId());
            panelDto.setName(panel.getName());
            panelDto.setType(panel.getType());
            panelDto.setSortOrder(panel.getSortOrder());
            panelDto.setPosition(panel.getPosition());
            panelDto.setLimitNum(panel.getLimitNum());
            panelDto.setStatus(panel.getStatus());
            panelDto.setRemark(panel.getRemark());
            panelDto.setPanelContentItems(list);
            set.add(panelDto);
        }
        return set;
    }
}
